
img = rgb2gray(ironfence);
imshow(img);
F = fft2(img);
Fsh = fftshift(F);
figure;
imshow(log(1 + abs(Fsh)), []);
iF = real(ifft2(F));
figure;
imshow(iF, []);

% 1

T = F;
w = size(img, 1);
h = size(img, 2);
M = real(ones(w, h));
M(ceil(w*0.25):ceil(w*0.75), : ) = 0;
M( : , ceil(h*0.25):ceil(h*0.75) ) = 0;
T = T .* (1 - M);
figure;
imshow(log(1 + abs(fftshift(T))), []);
iT = real(ifft2(T));
figure;
imshow(iT, []);

T2 = F;
T2 = T2 .* M;
figure;
imshow(log(1 + abs(fftshift(T2))), []);
iT2 = real(ifft2(T2));
figure;
imshow(iT2, []);

% 2
iFsh = real(ifft2(Fsh));
figure;
imshow(iFsh, []);

% 3
